package org.voyager.service.admin.scenic.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.voyager.common.beans.JsonResult;
import org.voyager.service.admin.scenic.service.ScenicSpotService;
import org.voyager.service.admin.scenic.vo.ScenicSpotAddVo;

import com.alibaba.fastjson.JSONObject;

/**
 * 景点
 */
@RestController
@RequestMapping("/scenic/spot/")
public class ScenicSpotController {

	@Autowired
	private ScenicSpotService scenicSpotService;
	
	@PostMapping("/add")
	public JsonResult add(@RequestBody ScenicSpotAddVo scenicSpotAddVo) {
		return scenicSpotService.addSpot(scenicSpotAddVo);
	}
	
	@PostMapping("/edit")
	public JsonResult edit(@RequestBody ScenicSpotAddVo scenicSpotAddVo) {
		return scenicSpotService.editSpot(scenicSpotAddVo);
	}
	
	@PostMapping("/del")
	public JsonResult del(@RequestBody JSONObject jo) {
		return scenicSpotService.delSpot(jo.getString("id"));
	}
	
	@PostMapping("/query")
	public JsonResult queryById(@RequestBody JSONObject jo) {
		return scenicSpotService.getById(jo.getString("id"));
	}
	
	@PostMapping("/list")
	public JsonResult pageList(@RequestBody ScenicSpotAddVo scenicSpotAddVo) {
		return scenicSpotService.pageList(scenicSpotAddVo);
	}
	
	@PostMapping("/all")
	public JsonResult allList() {
		return scenicSpotService.allList();
	}
}
